package day5;

import java.util.Scanner;

/**
 * @author oldliu
 * @since 1.0
 */
public class Array5 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int a1[] = new int[5];
        for (int i = 0; i < a1.length; i++) {
            System.out.print("请输入数组第" + (i + 1) + "个值");
            a1[i] = in.nextInt();
        }
        int total = 0;
        //放大10倍
        for (int i = 0; i < a1.length; i++) {
            a1[i] *= 10;
        }
        //求和
//        for (int i = 0; i < a1.length; i++) {
//            total += a1[i];
//        }
        for (int i = 0; i < a1.length; i++) {
            System.out.println(i + ":" + a1[i]);
        }

        for (int t : a1) {//增强for
            System.out.println("t:" + t);
            total += t;//t就是数组中的元素
        }
        int avg = total / a1.length;
        System.out.println("平均值是:" + avg);
    }
}
